import pika

username = 'root'
password = '123456'

credentials = pika.credentials.PlainCredentials(username, password)
parameters = pika.ConnectionParameters(host='localhost', credentials=credentials)
connection = pika.BlockingConnection(parameters)
channel = connection.channel()

# 没有则创建队列
# channel.queue_declare(queue='hello')
channel.queue_declare(queue='delay_queue2', arguments={'x-message-ttl': 1000 * 10})

channel.basic_publish(exchange='', routing_key='hello', body=b'Hello World!')
print(" [x] Sent success")
connection.close()
